//
//  SGInfomationVideoCell.m
//  MomHelp
//
//  Created by xuguoyong on 16/8/22.
//  Copyright © 2016年 hudongkeji. All rights reserved.
//

#import "SGInfomationVideoCell.h"
#import "SGInfomationVideoView.h"
@interface SGInfomationVideoCell  ()
{
    //视频封面图
    SGInfomationVideoView *_videoView;
    //视频标题
    XGYLabel *_videoTitleLabel;
    //显示[视频]
    XGYLabel *_typeLabel;
    //资讯传递
    XGYLabel *_infomationTransmitLabel;
    
}
@end


@implementation SGInfomationVideoCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupImageView];
    }
    return self;
}
- (void)setupImageView
{
    
    _videoView = [[SGInfomationVideoView alloc] init];
    [self.contentView addSubview:_videoView];
    
    
    _typeLabel  = [[XGYLabel alloc]init];
    _typeLabel.textColor = MainColor;
    _typeLabel.text = @"[视频]";
    _typeLabel.font = textFont38;
    [self.contentView addSubview:_typeLabel];
    
    _videoTitleLabel  = [[XGYLabel alloc]init];
    _videoTitleLabel.textColor = textColor333333;
    _videoTitleLabel.text = @"这个女人震惊了13亿人";
    _videoTitleLabel.font = textFont38;
   
    [self.contentView addSubview:_videoTitleLabel];
    
    _infomationTransmitLabel  = [[XGYLabel alloc]init];
    _infomationTransmitLabel.textColor = textColor666666;
    _infomationTransmitLabel.text = @"1位妈妈传递爱心";
    _infomationTransmitLabel.font = textFont24;
    [self.contentView addSubview:_infomationTransmitLabel];
    [self setupFrame];
    
}

- (void)setupFrame
{
    //视频封面
    _videoView.sd_layout.topSpaceToView(self.contentView,15).rightSpaceToView(self.contentView,15).leftEqualToView(self.contentView).offset(15).autoHeightRatio(424.0f/690.0f);
    
    //视频 [视频]
    _typeLabel.sd_layout.topSpaceToView(_videoView,5).leftEqualToView(_videoView).heightIs(20);
    [_typeLabel setSingleLineAutoResizeWithMaxWidth:100];
    
    //视频标题
    _videoTitleLabel.sd_layout.topEqualToView(_typeLabel).leftSpaceToView(_typeLabel,5).heightRatioToView(_typeLabel,1).rightEqualToView(_videoView);
    
    //传递资讯
    _infomationTransmitLabel.sd_layout.topSpaceToView(_typeLabel,10).rightEqualToView(_videoView).heightIs(20);
    [_infomationTransmitLabel setSingleLineAutoResizeWithMaxWidth:200];
    [self setNeedsLayout];
}
@end
